<?php
/**
 * Created by PhpStorm.
 * User: Hello pan
 * Date: 9/13/25
 * Time: 10:21 PM
 */

namespace app\behaviors;

use yii\web\Controller;

class TestBehavior extends \yii\base\Behavior
{

    public function events()
    {
        return [
            Controller::EVENT_BEFORE_ACTION => 'beforeAction',
            Controller::EVENT_AFTER_ACTION  => 'afterAction',
        ];
    }


    public function beforeAction($event)
    {
        p('我只执行了Behaviors-》beforeAction');
    }

    public function afterAction()
    {
        p('我是afterAction');

    }

}